<!--
 * @Author: asushiye
 * @Date: 2020-07-02 15:30:23
 * @Commit: file content
-->
<page-header autoTitle="false" />

<nz-card>
  <form nz-form nzLayout="inline" se-container>
    <se label="映射模版" labelWidth="0">
      <nz-select
        id="mappingTemplate"
        style="width: 160px"
        [(ngModel)]="queryParams.mappingTemplate"
        [ngModelOptions]="{ standalone: true }"
      >
        <!-- <nz-option nzLabel="default" nzValue="default" ></nz-option> -->
        <nz-option *ngFor="let item of templates" [nzLabel]="item" [nzValue]="item" />
      </nz-select>
    </se>
    <se>
      <button nz-button nzType="primary" (click)="query()" [nzLoading]="isLoading">查询</button>
      <button nz-button nzType="default" (click)="importData()" [nzLoading]="isLoading">
        <span>导入</span>
        <i nz-icon nzType="import"></i>
      </button>
      <button nz-button nzType="default" (click)="exportData()" [nzLoading]="isExporting">
        <span>导出</span>
        <i nz-icon nzType="export"></i>
      </button>
      <button nz-button [nzType]="'default'" (click)="downloadTemplate()">
        <span>下载模板</span>
        <i nz-icon nzType="download"></i>
      </button>

      <button nz-button nz-dropdown [nzDropdownMenu]="menu" [nzLoading]="isLogExporting">
        历史日志
        <i nz-icon nzType="down"></i>
      </button>
      <nz-dropdown-menu #menu="nzDropdownMenu">
        <ul nz-menu>
          <li nz-menu-item>
            <a (click)="exportLog()"> 下载当前日志 </a>
          </li>
          <li nz-menu-item>
            <a (click)="navUploadLogView()">历史上传记录 </a>
          </li>
        </ul>
      </nz-dropdown-menu>
      <button nz-button nzType="default" (click)="rebuildDefaultClick()" [nzLoading]="isLoading">重建默认类型映射</button>
    </se>
  </form>
  <div style="color: red"
    >通用码与不同数据库的类型映射按一对一的映射； 若不同数据库的类型映射会出现一对多情况，则取编号最大的数据类型。</div
  >
  <st
    #st
    [data]="rows"
    [columns]="columns"
    [expand]="expand"
    [ps]="20"
    size="small"
    [scroll]="{ x: '1800px' }"
    expandRowByClick
    expandAccordion
  >
    <ng-template #expand let-item let-index="index" let-column="column">
      <sv-container size="small" col="3">
        <sv-title>更多内容</sv-title>
        <sv label="maxcompute2">{{ item!.maxcompute2 }}</sv>
        <!-- <sv label="flink">{{ item!.flink }}</sv> -->
        <sv label="hologres">{{ item!.hologres }}</sv>
        <sv label="clickhouse">{{ item!.clickhouse }}</sv>
        <sv label="java">{{ item!.java }}</sv>
        <sv label="备注">{{ item!.remark }}</sv>
        <sv label="创建人">{{ item!.createdBy }}</sv>
        <sv label="创建时间">{{ item!.createdDate }}</sv>
      </sv-container>
    </ng-template>
  </st>
</nz-card>
